package com.eorchis.module.loginauthentication.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.eorchis.core.basedao.dao.IDaoSupport;
import com.eorchis.core.basedao.entity.IBaseEntity;
import com.eorchis.core.service.impl.AbstractBaseService;
import com.eorchis.core.ui.commond.ICommond;
import com.eorchis.module.loginauthentication.dao.ILoginAuthenticationDao;
import com.eorchis.module.loginauthentication.domain.LoginAuthenticationBean;
import com.eorchis.module.loginauthentication.domain.SysDepSysRoleView;
import com.eorchis.module.loginauthentication.service.ILoginAuthenticationService;
import com.eorchis.module.loginauthentication.ui.commond.LoginAuthenticationQueryCommond;
import com.eorchis.module.security.cas.domain.Role;
import com.eorchis.module.trainingquestionnaire.ui.commond.QuestionnaireQueryCommond;

/**
 * 
 * Title: ConfigurationServiceImpl<br>
 * Description: <br>
 * Copyright @ 2011~2015 Goldgov .All rights reserved.<br>
 * 
 * @author GuoL
 * @createDate 2015-8-14
 * @version $Revision: $
 */
@Service(value = "com.eorchis.module.loginauthentication.service.impl.LoginAuthenticationServiceImpl")
public class LoginAuthenticationServiceImpl extends AbstractBaseService implements ILoginAuthenticationService {

	@Resource(name = "com.eorchis.module.loginauthentication.dao.impl.LoginAuthenticationDaoImpl")
	private ILoginAuthenticationDao loginAuthenticationDao;
	
	@Override
	public IDaoSupport getDaoSupport() {
		return loginAuthenticationDao;
	}


	@Override
	public <C extends ICommond> C toCommond(IBaseEntity arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	
	/**
	 * 判断人员是否存在
	 */
	@Override
	public LoginAuthenticationBean userLogin(QuestionnaireQueryCommond queryCommond) {
		// TODO Auto-generated method stub
		return loginAuthenticationDao.userLogin(queryCommond);
	}

	/**
	 * 判断是否为本班学员
	 * @return
	 * @author LongJZ
	 * @date 2016-2-18
	 */
	public boolean isThisClassUser(QuestionnaireQueryCommond queryCommond) {
		return loginAuthenticationDao.isThisClassUser(queryCommond);
	}

	/**
	 * 判断班级评估方式
	 * @author RongSL
	 * @Date 2017-02-14
	 * */
	public int isAssessmentMode(QuestionnaireQueryCommond queryCommond){
		return loginAuthenticationDao.isAssessmentMode(queryCommond);
	}
	
	/**
	 * 判断账号是否存在or判断密码是否错误
	 * @author RongSL
	 * 2018年3月28日
	 * */
	@Override
	public int isExistUser(LoginAuthenticationQueryCommond queryCommond) throws Exception{
		return loginAuthenticationDao.isExistUser(queryCommond);
	}
	
	/**
	 * 查询人员角色权限表
	 * */
	@Override
	public List<SysDepSysRoleView> findUumSysDepRoleView(LoginAuthenticationQueryCommond queryCommond) throws Exception{
		return loginAuthenticationDao.findUumSysDepRoleView(queryCommond);
	}
	
	/**
	 * 查询角色（学员用）
	 * */
	@Override
	public Role findRole(LoginAuthenticationQueryCommond queryCommond) throws Exception{
		return loginAuthenticationDao.findRole(queryCommond);
	}
}
